<!--
 * @Author: huangtianyang 916072572@qq.com
 * @Date: 2023-05-30 14:06:30
 * @LastEditors: huangtianyang
 * @LastEditTime: 2023-10-24 16:09:31
 * @FilePath: \cxl-h5\index.html
-->
<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8" />
  <link rel="icon" type="image/svg+xml" href="/favicon.ico" />
  <meta name="viewport"
    content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no" />
  <meta name="color-scheme" content="light dark" />
  <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
  <meta http-equiv="Pragma" content="no-cache" />
  <meta http-equiv="Expires" content="0" />
  <meta name="referrer" content="no-referrer" />
  <meta name="screen-orientation" content="portrait" />
  <meta name="x5-orientation" content="portrait">


  <title>车况查询</title>
  <link rel="stylesheet" href="./src/assets/iconfont/iconfont.css">
  <script src="https://unpkg.com/vconsole@latest/dist/vconsole.min.js"></script>
  <script>

    (function () {
      // 在标准 750px 适配下，24px = 1rem;
      var baseFontSize = 24
      var baseWidth = 750

      var set = function () {
        var clientWidth = document.documentElement.clientWidth || window.innerWidth

        var rem = 24
        if (clientWidth != baseWidth) {
          rem = Math.floor((clientWidth / baseWidth) * baseFontSize)
        }

        document.querySelector('html').style.fontSize = rem + 'px'
      }
      set()

      window.addEventListener('resize', set)

      // 强制禁止用户修改微信客户端的字体大小
      if (typeof WeixinJSBridge == 'object' && typeof WeixinJSBridge.invoke == 'function') {
        handleFontSize()
      } else {
        if (document.addEventListener) {
          document.addEventListener('WeixinJSBridgeReady', handleFontSize, false)
        } else if (document.attachEvent) {
          document.attachEvent('WeixinJSBridgeReady', handleFontSize)
          document.attachEvent('onWeixinJSBridgeReady', handleFontSize)
        }
      }
      function handleFontSize() {
        // 设置网页字体为默认大小
        WeixinJSBridge.invoke('setFontSizeCallback', { fontSize: 0 })
        // 重写设置网页字体大小的事件
        WeixinJSBridge.on('menu:setfont', function () {
          WeixinJSBridge.invoke('setFontSizeCallback', { fontSize: 0 })
        })
      }
    })()


    // 判断用户使用的浏览器，如果不是在微信内置浏览器打开，会跳到提示用户使用微信登录页面
    var useragent = navigator.userAgent
    if (useragent.match(/MicroMessenger/i) != 'MicroMessenger') {
      console.log(window.location)
      if (window.location.href.indexOf("port=PC") == -1) {
        //不存在此参数 port = PC
        window.location.href = "./wxError.html";
      }
    }
  </script>
  <style>
    html {
      margin: 0;
      padding: 0;
    }
  </style>
</head>

<body>
  <section id="app"></section>
  <script type="module" src="/src/main.ts"></script>
</body>

</html>